﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using IBTS.BO.Objects;
using IBTS.BL.Core;

namespace IBTS.WCF.Core
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class IBTSKeys : IIBTSKeys
    {
        public List<KeysItem> GetAllKeys()
        {
            List<KeysItem> toReturn = new List<KeysItem>();

            try
            {
                toReturn = BusinessUtils.KeysService.GetAllKeys();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return toReturn;
        }

        public int Insert(KeysItem toInsert)
        {
            int toReturn = 0;

            try
            {
                toReturn = BusinessUtils.KeysService.Insert(toInsert);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return toReturn;
        }

        public int Update(KeysItem toUpdate)
        {
            int toReturn = 0;

            try
            {
                toReturn = BusinessUtils.KeysService.Update(toUpdate);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return toReturn;
        }

        public int Delete(long idToDelete)
        {
            int toReturn = 0;

            try
            {
                toReturn = BusinessUtils.KeysService.Delete(idToDelete);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return toReturn;
        }
    }
}
